package es.acaixa.agui;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JTable;
import javax.swing.JButton;
import javax.swing.table.DefaultTableModel;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JScrollPane;

public class ConsultarProduto extends JFrame {

	private JPanel contentPane;
	private JTable table;
	private JTextField txtId;
	private JTextField txtNome;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					ConsultarProduto frame = new ConsultarProduto();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public ConsultarProduto() {
		setTitle("Consultar Produto");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 527, 378);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JButton btnEditar = new JButton("editar");
		btnEditar.setBounds(418, 39, 89, 23);
		contentPane.add(btnEditar);
		
		JButton btnRemover = new JButton("remover");
		btnRemover.setBounds(418, 73, 89, 23);
		contentPane.add(btnRemover);
		
		JLabel lblId = new JLabel("Id");
		lblId.setBounds(20, 15, 46, 14);
		contentPane.add(lblId);
		
		txtId = new JTextField();
		txtId.setBounds(45, 12, 86, 20);
		txtId.setText("id");
		contentPane.add(txtId);
		txtId.setColumns(10);
		
		JLabel lblOu = new JLabel("ou");
		lblOu.setBounds(177, 15, 46, 14);
		contentPane.add(lblOu);
		
		JLabel lblNome = new JLabel("nome");
		lblNome.setBounds(223, 15, 46, 14);
		contentPane.add(lblNome);
		
		txtNome = new JTextField();
		txtNome.setBounds(279, 12, 86, 20);
		txtNome.setText("nome");
		contentPane.add(txtNome);
		txtNome.setColumns(10);
		
		JButton btnBuscar = new JButton("buscar");
		btnBuscar.setBounds(418, 11, 89, 23);
		contentPane.add(btnBuscar);
		
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBounds(10, 70, 398, 108);
		contentPane.add(scrollPane);
		
		table = new JTable();
		scrollPane.setViewportView(table);
		table.setModel(new DefaultTableModel(
			new Object[][] {
				{null, null, "", null, null, null, null, null},
				{null, null, null, null, null, null, null, null},
				{null, null, null, null, null, null, null, null},
				{null, null, null, null, null, null, null, null},
				{null, null, null, null, null, null, null, null},
			},
			new String[] {
				"id", "Nome", "tipo", "tempo", "disponibilidade", "descri\u00E7\u00E3o", "pre\u00E7o", "Nota media"
			}
		) {
			Class[] columnTypes = new Class[] {
				String.class, String.class, String.class, Object.class, Boolean.class, String.class, String.class, Object.class
			};
			public Class getColumnClass(int columnIndex) {
				return columnTypes[columnIndex];
			}
		});
	}

}
